home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Games Machine 76
/
XENIATGM66.iso
/
Indiana Jones
/
Indiana Jones.exe
/
RESOURCE
/
PREVIEW.GOB
/
cog_vol_commie_elevswitch.cog
< prev
next >
Wrap
Text File
|
1999-11-15
|
18KB
|
674 lines
# Jones 3D Cog Script
#
# vol_Commie_ElevSwitch.cog
#
# This elevator will come down to frame one, sleep, then return to frame 0.
#
# [CM & revised by HB]
#
# (C) 1999 LucasArts Entertainment Co. All Rights Reserved
# ==============================================================================
symbols
#...............MESSAGES.................
message startup
message activated
message arrived
message entered
message exited
message blocked
#...............ROUTINES.................
flex elev_up local
flex elev_down local
flex cutscene_up local
flex cutscene_down local
#...............ACTORS...................
thing player local
thing indyActor
thing deadIndy local
thing commie0
thing commie1
thing commie2
thing commie3
#...............ACTOR MARKS..............
thing elev_INMV0
thing elev_INMV1
thing elev_INFLEEMK0
thing elev_INFLEEMK1
thing comMV0
thing comMV1
thing comMV2
thing comMV3
#...............ACTOR LOOK TARGETS.......
thing elev_INLK0
thing elev_INLK1
#...............CAMERAS..................
thing topcam
thing bottomcam
thing finalCam
#...............PROPS..............
thing elevator
thing button0
thing button1
thing winch
thing animatedwinch
thing cable_start # startingpoint for the polyline cable
thing cable_end # endpoint for the polyline cable
surface groundkill
#...............KEYFRAMES..............
keyframe winchrun=vol_winch_up.key local
keyframe winchrun_dn=vol_winch_down.key local
keyframe inDie=in_die_buckle.key local
keyframe in_bothup=0in_armsup_1_1.key local
#...............MATERIALS..............
material boxfront=box_aswitch_frnt.mat local
material cableskin=riv_floor_metal.mat local
#...............VARIABLES..............
vector v_camspot local
flex start_wait=1.5 local # pause_before_moving_up
flex sleeptime=4.0 local
flex speed=3.0 local
flex rotref local # store maxrotvel of the indy actor
int com_rush=0 local # control var for the commies rush attack
int winchKey local # channel for winch keyframe
int i local # for loops
int hit=0 local # for non-repetition
int in_thespot=0 local # for cutscene aspect of elevator motion
int grnd_spot=0 local # if indy enters the ground below the elevator
int deadMan=0 local # if indy dies
int victim local
int elev_dir=0 local # 1 for down, 0 for up
int btn_colltype local
#...............TEMPLATES..............
template tpl_Indy=indy_sh_actor local
#...............SOUNDS..............
sound switch=sol_panel_switch_c.wav local
sound terror_cue=mus_gen_russbold_shrt1.wav local
sound sndDie=tem_temspikes_up_kill_c.wav local
# wrong item...
sound in_itemline0=Inxj089.wav local # That didn't work.
sound in_itemline1=Inxj090.wav local # ...something wrong.
sound in_itemline2=Inxj092.wav local # Hmm...didn't quite work.
sound in_itemline3=Inxj060.wav local # I don't think...right answer.
sound in_itemline4=Inxj087.wav local # Whoops.
sound in_itemline5=Inxj088.wav local # Nope.
sound in_itemline6=Inxj091.wav local # Of course that didn't work.
# wrong spot...
sound in_wrongspot0=Inxj219.wav local # Not lined up right
sound in_wrongspot1=Inxj220.wav local # Need to line up
sound in_wrongspot2=Inxj221.wav local # Need to move over.
sound in_wrongspot3=Inxj222.wav local # Not quite in position.
sound in_wrongspot4=Inxj223.wav local # Need to get in position.
sound in_wrongspot5=Inxj224.wav local # Need to find better spot.
#...............VECTORS AND POSITION VARS..............
vector v_ipyr local
flex yaw local
flex randlocationlines local
flex randwrongitemlines local
int l_newline=50 local
int l_oldline=50 local
int wi_newline=50 local
int wi_oldline=50 local
int cursound local
int doplay local
int cursound local
int speak0 local
int played=0 local
end
# ==============================================================================
code
startup:
# intitialize player
player = GetLocalPlayerThing();
# anchor the endpoints of the poly line
AttachThingToThingex(cable_end, elevator, 0x000C);
# lock elevcenter target to the elev
AttachThingToThingex(elev_INMV1, elevator, 0x000C);
# clear the winch for keyframes
SetThingFlags(animatedwinch, 0x80000);
# draw the cable for the elevator
CreatePolylineThing(cable_end, cable_start, '0 0 0', cableskin, 0.0025, 0.0025, 0.0);
CreatePolylineThing(cable_start, cable_end, '0 0 0', cableskin, 0.0025, 0.0025, 0.0);
# initialize elev kill int
elev_dir=0;
for (i = 0; i <= 3; i = i + 1)
{
AISetCutSceneMode(commie0[i]);
}
SetMaterialCel(boxfront, 1);
return;
# ==============================================================================
activated: // If player presses button0
If (hit == 1) return;
If (IsMoving(elevator) != 0) return;
If ((GetSenderRef() == button0) && (GetCurFrame(elevator) == 1)) return;
If ((GetSenderRef() == button0) && (GetCurFrame(elevator) == 0))
{
# call from bottom
hit = 1;
if (GetCurItem(player) >= 1)
{
# player is using a wrong item
StartCutScene(1);
call randwrongitemlines;
EndCutscene();
hit = 0;
return;
}
# get players' position
v_ipyr = GetThingLVecPYR(player);
yaw = VectorY(v_ipyr);
# failure routine and drop out if player has improper pyr
if ((yaw > 65) || (yaw < -20))
{
StartCutscene(1);
call randlocationlines;
EndCutscene();
hit = 0;
return;
}
# animate the player
MakeMeStop();
DeselectWeaponWait(player);
PlayMode(player, 60, 1);
Sleep(0.25);
PlaySoundLocal(switch, 1, 0, 0, 0);
SetMaterialCel(boxfront, 0); # green light
# bring the elevator down
call elev_down;
WaitForStop(elevator);
Sleep(sleeptime);
# send the elevator up
call elev_up;
# cutscene style for indy if on the elevator
call cutscene_up;
WaitForStop(elevator);
# cutscene release for indy if on the elevator
If (in_thespot == 1)
{
# exit at top...
SetCameraPosition(1, GetThingPos(topcam));
SetCurrentCamera(1);
# restore the player
TeleportThing(player, indyActor);
AIClearCutSceneMode(indyActor);
SetThingFlags(indyActor, 0x80000);
ClearThingFlags(player, 0x80000);
SetThingAlpha(player, 1.0);
EndCutScene();
ClearActorFlags(player, 0x200000);
}
}
If ((GetSenderRef() == button1) && (GetCurFrame(elevator) == 1)) return;
If ((GetSenderRef() == button1) && (GetCurFrame(elevator) == 0))
{
# call from top
hit = 1;
if (GetCurItem(player) >= 1)
{
# player is using a wrong item
StartCutScene(1);
call randwrongitemlines;
EndCutscene();
hit = 0;
return;
}
# get players' position
v_ipyr = GetThingLVecPYR(player);
yaw = VectorY(v_ipyr);
# failure routine and drop out if player has improper pyr
if ((yaw < -167) || (yaw > -73))
{
StartCutscene(1);
call randlocationlines;
EndCutscene();
hit = 0;
return;
}
in_thespot = 1;
# animate the player
StartCutscene(1);
MakeMeStop();
DeselectWeaponWait(player);
PlayMode(player, 60, 1);
# prep actor
CopyPlayerHolsters(player, indyActor);
TeleportThing(indyActor, player);
AISetCutSceneMode(indyActor);
SetThingFlags(player, 0x80000);
ClearThingFlags(indyActor, 0x80000);
SetThingAlpha(indyActor, 1.0);
# goto cutscene cam
SetCameraLookInterp(2, 0);
SetCameraPosInterp(2, 0);
SetCameraFocus(2, topcam);
SetCameraSecondaryFocus(2, indyActor);
SetCurrentCamera(2);
SetCameraFOV(80, 0, 0.0);
Sleep(0.25);
PlaySoundLocal(switch, 1, 0, 0, 0);
SetMaterialCel(boxfront, 0);
# move the actor to the center of the elevator
rotref=(GetThingMaxRotVel(indyActor));
SetThingMaxRotVel(indyActor, 150);
AISetLookThingEyeLevel(indyActor, elev_INMV0);
Sleep(0.3);
AISetMoveSpeed(indyActor, 1.0);
AISetMoveThing(indyActor, elev_INMV0, 0);
Sleep(1.0);
AISetLookThingEyeLevel(indyActor, elev_INMV1);
AISetMoveThing(indyActor, elev_INMV1, 1);
AISetLookThingEyeLevel(indyActor, elev_INLK0);
AIWaitForStop(indyActor);
# send the elevator down
call elev_down;
Sleep(3.0);
# cut to bottom cam
SetCameraFocus(2, bottomcam);
SetCameraSecondaryFocus(2, indyActor);
SetCameraFOV(75, 0, 0.0);
#Sleep(1.75);
WaitForStop(elevator);
elev_dir=0;
# restore the player
TeleportThing(player, indyActor);
AIClearCutSceneMode(indyActor);
SetThingMaxRotVel(indyActor, rotref);
SetThingFlags(indyActor, 0x80000);
ClearThingFlags(player, 0x80000);
# restore the camera
v_camspot = VectorAdd(VectorTransformToOrient(player, '0.1 -0.18 0.05'), GetThingPos(player));
SetCameraPosition(1, v_camspot);
SetCurrentCamera(1);
EndCutScene();
ClearActorFlags(player, 0x200000);
Sleep(sleeptime);
call elev_up;
# cutscene style for indy if on the elevator
call cutscene_up;
WaitForStop(elevator);
# cutscene release for indy if on the elevator
If (in_thespot == 1)
{
SetCameraPosition(1, GetThingPos(topcam));
SetCurrentCamera(1);
# restore the player
TeleportThing(player, indyActor);
AIClearCutSceneMode(indyActor);
SetThingFlags(indyActor, 0x80000);
ClearThingFlags(player, 0x80000);
SetThingAlpha(player, 1.0);
EndCutScene();
print("out of cutscenemode");
ClearActorFlags(player, 0x200000);
}
}
return;
# ==============================================================================
arrived:
If ((GetSenderRef() == elevator) && (GetCurFrame(elevator) == 0))
{
# at bottom
SetMaterialCel(boxfront, 1);
StopKey(animatedwinch, winchKey, 0.0);
ClearThingFlags(winch, 0x80000);
SetThingFlags(animatedwinch, 0x80000);
hit = 0;
}
If ((GetSenderRef() == elevator) && (GetCurFrame(elevator) == 1))
{
# at top
StopKey(animatedwinch, winchKey, 0.0);
ClearThingFlags(winch, 0x80000);
SetThingFlags(animatedwinch, 0x80000);
}
return;
# ==============================================================================
entered:
If ((GetSenderRef() == elevator) && (GetSourceRef() == player))
{
in_thespot = 1;
}
If ((GetSenderRef() == groundkill) && (GetSourceRef() == player))
{
grnd_spot = 1;
}
return;
# ==============================================================================
exited:
If ((GetSenderRef() == elevator) && (GetSourceRef() == player))
{
in_thespot = 0;
}
If ((GetSenderRef() == groundkill) && (GetSourceRef() == player))
{
grnd_spot = 0;
}
return;
# ==============================================================================
blocked:
#if(elev_dir == 0) return;
if((GetSenderRef() == elevator) && (grnd_spot == 1))
{
If (com_rush == 0)
{
for (i = 0; i <= 3; i = i + 1)
{
AttachThingToThingEx(commie0[i], elevator, 0x000C);
}
}
#SetCollideType(elevator, 0);
DamageThing(player, 1000.0, 0x1, player);
PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
# Disable and hide player
#SetThingFlags(player, 0x80000);
# create actor indy
#deadIndy = CreateThing(tpl_Indy, player);
#CaptureThing(deadIndy);
# Show actor Indy and play Keyframe
#ClearThingFlags(deadIndy, 0x80000);
#PlayKey(deadIndy, inDie, 4, 0x14, 0);
#Sleep(1.0);
#SetCollideType(elevator, 3);
}
return;
# ==============================================================================
elev_down:
# move elevator, animate winch
elev_dir=1; # elevator down
MovetoFrame(elevator, 1, speed);
btn_colltype = GetCollideType(button0);
SetCollideType(button0, 0);
# hide the collision winch, show the animated one
SetThingFlags(winch, 0x80000);
ClearThingFlags(animatedwinch, 0x80000);
winchKey=PlayKey(animatedwinch, winchrun_dn, 4, 0x0, 0);
# cutscene action on first descent...
If (com_rush == 0)
{
StartCutscene(2);
SetCameraLookInterp(2, 0);
SetCameraPosInterp(2, 0);
SetCameraFocus(2, bottomcam);
SetCameraSecondaryFocus(2, elev_INMV1);
SetCurrentCamera(2);
SetCameraFOV(75, 0, 0.0);
# Set up actor
CopyPlayerHolsters(player, indyActor);
TeleportThing(indyActor, player);
AISetCutSceneMode(indyActor);
SetThingFlags(player, 0x80000);
ClearThingFlags(indyActor, 0x80000);
SetThingAlpha(indyActor, 1.0);
AIEnableHeadTracking(indyActor, elev_INMV1);
# play the music cue
PlaySoundLocal(terror_cue, 0.5, 0, 0, 0);
Sleep(4.25);
#elev_dir = 0;
#print("elev_dir = 0");
AIDisableHeadTracking(indyActor);
AISetLookThing(indyActor, elev_INFLEEMK0);
AISetMoveSpeed(indyActor, 2.5); # run, Indy!
Sleep(0.3);
AISetMoveThing(indyActor, elev_INFLEEMK0, 0);
Sleep(1.0);
for (i = 0; i <= 3; i = i + 1)
{
ClearActorFlags(commie0[i], 0x40000);
AISetMoveSpeed(commie0[i], 2.5);
AISetLookThing(commie0[i], comMV0[i]);
AISetMoveThing(commie0[i], comMV0[i], 0);
}
Sleep(1.5);
for (i = 0; i <= 3; i = i + 1)
{
AIClearCutsceneMode(commie0[i]);
AISetFireTarget(commie0[i], player);
}
com_rush = 1;
# restore the player
TeleportThing(player, elev_INFLEEMK1);
AIClearCutSceneMode(indyActor);
SetThingFlags(indyActor, 0x80000);
ClearThingFlags(player, 0x80000);
# swing camera back to normal
v_camspot = VectorAdd(VectorTransformToOrient(player, '-0.1 -0.05 0.0'), GetThingPos(player));
SetCameraPosition(1, v_camspot);
SetCurrentCamera(1);
}
SetCollideType(button0, btn_colltype);
EndCutscene();
ClearActorFlags(player, 0x200000);
elev_dir = 0;
return;
# ==============================================================================
elev_up:
elev_dir=0; # elevator up
MovetoFrame(elevator, 0, speed);
# hide the collision winch, show the animated one
SetThingFlags(winch, 0x80000);
ClearThingFlags(animatedwinch, 0x80000);
winchKey=PlayKey(animatedwinch, winchrun, 4, 0x0, 0);
return;
# ==============================================================================
cutscene_up:
If (in_thespot == 1)
{
MakeMeStop();
StartCutScene(1);
# Set up actor
CopyPlayerHolsters(player, indyActor);
TeleportThing(indyActor, player);
AISetCutSceneMode(indyActor);
SetThingFlags(player, 0x80000);
ClearThingFlags(indyActor, 0x80000);
SetThingAlpha(indyActor, 1.0);
# cut to coverage
SetCameraLookInterp(2, 0);
SetCameraPosInterp(2, 0);
SetCameraFocus(2, bottomcam);
SetCameraSecondaryFocus(2, indyActor);
SetCurrentCamera(2);
SetCameraFOV(80, 0, 0.0);
# move actor to the center of the platform
rotref=(GetThingMaxRotVel(indyActor));
SetThingMaxRotVel(indyActor, 150);
AISetMoveSpeed(indyActor, 1.0);
AISetLookThingEyeLevel(indyActor, elev_INLK1);
Sleep(0.3);
AISetMoveThing(indyActor, elev_INMV1, 1);
Sleep(3.0);
# cut to top cam
SetCameraFocus(2, topcam);
SetCameraSecondaryFocus(2, indyActor);
SetThingMaxRotVel(indyActor, rotref);
}
return;
# ==============================================================================
randlocationlines:
while (l_newline == l_oldline)
{
l_newline = RandBetween(0, 5);
}
l_oldline = l_newline;
cursound = PlayVoice(player, in_wrongspot0[l_newline], 1, 0);
doplay = Randbetween(0, 2);
if ((doplay == 0) || (played == 0))
{
PlayKey(player, in_bothup, 4, 0x12, 0);
played = 1;
}
WaitForSound(cursound);
return;
# ==============================================================================
randwrongitemlines:
while (wi_newline == wi_oldline)
{
wi_newline = RandBetween(0, 19);
if (wi_newline < 15)
{
wi_newline = RandBetween(0, 3); # ~1/5 chance for lines 0 thru 3
}
if (wi_newline == 19)
{
wi_newline = 6; # 1/20 chance for line 6
}
if (wi_newline > 16)
{
wi_newline = 5; # 1/10 chance for line 5
}
if (wi_newline > 14)
{
wi_newline = 4; # 1/10 chance for line 4
}
}
wi_oldline = wi_newline;
speak0 = PlayVoice(player, in_itemline0[wi_newline], 1, 1);
return;
# ==============================================================================
end